import re
disp_int = '''
<Layer3Switch-1>display interface
GigabitEthernet0/0/1 current state : UP
Line protocol current state : UP
Description:
Switch Port, PVID :    1, TPID : 8100(Hex), The Maximum Frame Length is 9216
IP Sending Frames' Format is PKTFMT_ETHNT_2, Hardware address is 4c1f-cc92-675c
Last physical up time   : 2021-10-25 15:22:35 UTC-08:00
Last physical down time : 2021-10-25 15:22:33 UTC-08:00
......'''

print(disp_int)

a=re.search("Switch.+TPID.+Length.+",disp_int).group()
print(a)

mac='2, Hardware address is 4c1f-cc92-675c'
b=re.search(r'^\d+',mac).group()
print(b)


prompt='<Layer3Switch-1>display interface'
c=re.search(r'^.+>',prompt).group()
print(c)

# line=
line='Hardware address is 4c1f-cc92-675c'
d=re.search(r'\S+$',line).group()
print(d)

line1='Hardware address is 4c1f-cc92-675c'
e=re.search(r'[Hh]ard[Ww]are',line).group()
print(e)

commands=['<Layer3Switch-1>display interface','[Layer3Switch-2]display interface']
for command in commands:
	match=re.search(r'^.+[>\]]',command)
	if match:
		print(match.group())


line='Hardware address is 4c1f-cc92-675c'
f=re.search(r'[^0-9]',line).group()
print(f)
g=re.search(r'[^0-9]+',line)

h=re.search(r'Hardware | address',line).group()
print(h)

i=re.search(r'[0-9a-zA-Z]+-[0-9a-zA-Z]+-[0-9a-zA-Z]+',line).group()
print(i)

j=re.search(r'([0-9a-zA-Z]+-)+[0-9a-zA-Z]+',line).group()
print(j)